finding the percentage hackerrank solution in python 3